# Contributor: shum <shum@posteo.net>
# Maintainer: shum <shum@posteo.net>
pkgname=lgogdownloader
pkgver=3.12
pkgrel=2
pkgdesc="Open source downloader for GOG.com games"
url="https://github.com/Sude-/lgogdownloader"
arch="all"
license="WTFPL"
options="!check" # no testsuite
makedepends="help2man cmake boost-dev tinyxml2-dev jsoncpp-dev rhash-dev curl-dev htmlcxx-dev samurai"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/Sude-/lgogdownloader/archive/refs/tags/v$pkgver.tar.gz"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DUSE_QT_GUI=OFF \
		$CMAKE_CROSSOPTS

	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
d86d1542f48488f0fd0c880557bd95c0d5c561342690b4c635aebceab73aab9c605bbaaa72715d26b6578657cd2015138a0d3b804059931f3d9f3cac8e05e568  lgogdownloader-3.12.tar.gz
"
